package com.tleng.Nodos;

import org.antlr.runtime.Token;
import org.antlr.runtime.tree.CommonTree;

public class NodoTerminal extends NodoGenerico {

	public NodoTerminal(Token t) 
	{
		super(t);
	}
	
    public NodoTerminal(CommonTree node)
    { 
    	super(node); 
    }
    
    public String Imprimir()
    {
    	double alto = alto_superior + alto_inferior;
    	return "gsave " + x + " " + y + " moveto " + ancho + " " + alto + " scale (" +  this.token.getText() + ") show grestore\n";
    }
    
    /***
    Caso E1 = l ( terminal )
	------------------------
	
	l.x <- E1.x
	l.y <- E1.y
	l.escala <- E1.escala
	
	E1.ancho <- 0.6 * E1.escala
	E1.alto_superior <- 1 * E1.escala
	E1.alto_inferior <- 0
     */
    
    public void calcularAncho()
    {
    	this.ancho = 0.6 * this.escala;
    }
    
    public void calcularAlto()
    {
    	this.alto_inferior = 0;
    	this.alto_superior = 1 * this.escala;
    }
}
